package com.koron.plan.web.feign;

import com.github.pagehelper.PageInfo;
import com.koron.bean.base.Response;
import com.koron.bean.plan.patrol.dto.PatrolDto;
import com.koron.common.core.feignConfig.FeignFallbackFactory;
import com.koron.plan.web.maintainplan.bean.dto.MaintainDTO;
import com.koron.plan.web.maintainplan.bean.dto.OrderDispatchDto;
import com.koron.plan.web.repairplan.bean.dto.ExperimentDTO;
import com.koron.plan.web.repairplan.bean.dto.OverhaulOrderBean;
import com.koron.plan.web.repairplan.bean.dto.RepairDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author twcao
 * @title: OrderFeign
 * @projectName GDH_EAM_V2
 * @description: 工单
 * @date 2021/11/1010:04
 */
@FeignClient(value = "eam-service-order", fallbackFactory = FeignFallbackFactory.class)
public interface OrderFeign {

    /***************   大修计划  --->  大修工单   ***************/
    @PostMapping("/overhaul/draft/saveOrUpdate")
    Response<String> overhaulDraft(@RequestBody OverhaulOrderBean bean);

    @GetMapping("/overhaul/queryById")
    Response overhaulQueryById(@RequestParam("id") String id);

    /***************   巡视计划  --->  巡视工单   ***************/
    @PostMapping("/patrol/insertOrUpdate")
    Response<String> insertOrUpdate(@RequestBody PatrolDto patrolDto);

    /***************   巡视计划  --->  巡视工单(只插入主表和巡视人员数据)   ***************/
    @PostMapping("/patrol/insertPatrolUser")
    Response<Object> insertOrder(@RequestBody PatrolDto patrolDto);

    /***************   巡视计划  --->  巡视工单   ***************/
    @PostMapping("/linePatrol/insertOrUpdate")
    Response<String> insertOrUpdateLine(@RequestBody PatrolDto patrolDto);

    /***************   巡视计划  --->  巡视工单(只插入主表和巡视人员数据)   ***************/
    @PostMapping("/linePatrol/insertPatrolUser")
    Response<Object> insertOrderLine(@RequestBody PatrolDto patrolDto);

    /***************   维保计划 --->  日常维护工单   ***************/
    @PostMapping("/maintain/insertOrUpdate")
    Response<String> insertOrUpdate(@RequestBody MaintainDTO dto);

    @PostMapping("/maintain/dispatch/saveDispatchInfo")
    Response<String> saveDispatchInfo(@RequestBody OrderDispatchDto dispatchDto);

    /***************   试验计划 --->  试验工单   ***************/
    @PostMapping("/experiment/insertOrUpdate")
    Response<String> insertOrUpdateExperiment(@RequestBody ExperimentDTO dto);

    @PostMapping("/experiment/dispatch/saveDispatchInfo")
    Response<String> saveDispatchInfoExperiment(@RequestBody OrderDispatchDto dto);

    @GetMapping("/experiment/queryById")
    Response experimentQueryById(@RequestParam("id")String id);

    /***************   检修计划 --->  检修工单   ***************/
    @PostMapping("/repair/insertOrUpdate")
    Response<String> insertOrUpdate(RepairDTO dto);

    @GetMapping("/repair/queryById")
    Response repairQueryById(@RequestParam("id") String id);

    @GetMapping("/maintain/queryByPlanId")
    Response<PageInfo> queryByPlanId(@RequestParam("planId") String planId, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize);

    /***************   线路巡视计划 --->  根据风险管控单查询设备信息   ***************/
    @GetMapping("/lineRiskPart/listByRiskIds")
    Response<Object> listByRiskIds(@RequestParam("riskIds") List<String> riskIds);

    @GetMapping("/lineDefect/defectRate")
    Response<Object> defectRate(@RequestParam("currDs") String currDs, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    @GetMapping("/lineDefect/defectRateInTime")
    Response<Object> defectRateInTime(@RequestParam("currDs") String currDs, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

}
